﻿<Page x:Class="SoftTeach.View.Noten.MetroSchülereintragNotenPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
      xmlns:setting="clr-namespace:SoftTeach.Setting"
      xmlns:oxy="http://oxyplot.org/wpf"
      mc:Ignorable="d" 
      d:DesignHeight="768" 
      d:DesignWidth="1366"
      Title="Notengebung"
      FontSize="20"
      DataContext="{Binding Source={x:Static setting:Selection.Instance}, Path=Schülereintrag}">
  <Page.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SoftTeach;component/Resources/MetroResources.xaml"/>
        <ResourceDictionary >
          <CollectionViewSource x:Key="MündlicheQualitätViewSource" Source="{Binding MündlicheQualitätNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <CollectionViewSource x:Key="MündlicheQuantitätViewSource" Source="{Binding MündlicheQuantitätNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <CollectionViewSource x:Key="MündlicheWeitereViewSource" Source="{Binding MündlicheWeitereNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <CollectionViewSource x:Key="MündlicheStandViewSource" Source="{Binding MündlicheStandNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <CollectionViewSource x:Key="SchriftlicheStandViewSource" Source="{Binding SchriftlicheStandNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <CollectionViewSource x:Key="GesamtstandViewSource" Source="{Binding GesamtstandNotenCollection}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NoteDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>

          <CollectionViewSource x:Key="GruppierteHausaufgabenViewSource" Source="{Binding Hausaufgaben}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="HausaufgabeDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>

          <CollectionViewSource x:Key="GruppierteNotentendenzenViewSource" Source="{Binding Notentendenzen}">
            <CollectionViewSource.SortDescriptions>
              <componentModel:SortDescription PropertyName="NotentendenzDatum" Direction="Ascending" />
            </CollectionViewSource.SortDescriptions>
          </CollectionViewSource>
          <Style x:Key="MetroListBoxItemStyle" TargetType="ListBoxItem">
            <Setter Property="SnapsToDevicePixels" Value="true" />
            <Setter Property="OverridesDefaultStyle" Value="true" />
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Template">
              <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                  <Border x:Name="Border" SnapsToDevicePixels="true" IsManipulationEnabled="True"
                            TouchDown="Note_OnTouchDown"
                            TouchMove="Note_TouchMove"
                            TouchUp="Note_OnTouchUp">
                    <Border.Background>
                      <SolidColorBrush Color="Transparent" />
                    </Border.Background>
                    <VisualStateManager.VisualStateGroups>
                      <VisualStateGroup x:Name="SelectionStates">
                        <!--Clear all selection states-->
                        <VisualState x:Name="Unselected" />
                        <VisualState x:Name="Selected"/>
                        <VisualState x:Name="SelectedUnfocused"/>
                      </VisualStateGroup>
                      <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal" />
                        <VisualState x:Name="MouseOver">
                          <Storyboard>
                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
                                                  Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                              <EasingColorKeyFrame KeyTime="0" Value="{StaticResource MouseOverBackgroundColor}" />
                            </ColorAnimationUsingKeyFrames>
                          </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Disabled"/>
                      </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ContentPresenter />
                  </Border>
                </ControlTemplate>
              </Setter.Value>
            </Setter>
          </Style>

        </ResourceDictionary>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </Page.Resources>
  <ScrollViewer VerticalScrollBarVisibility="Auto">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="600"/>
      </Grid.ColumnDefinitions>
      <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Background="{StaticResource MetroHeaderBackground}">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
          </Grid.ColumnDefinitions>
          <Label Grid.Column="0" Foreground="White" HorizontalAlignment="Left" Content="{Binding Path=SchülereintragÜberschrift}"/>
          <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddNoteCommand}" ToolTip="Note anlegen" >
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Note32.png" />
                  <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
                </Grid>
                <Label Padding="5,0,0,0" VerticalContentAlignment="Center" Foreground="White">Note anlegen</Label>
              </StackPanel>
            </Button>
            <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Command="{Binding Path=AddNotentendenzCommand}" ToolTip="Notentendenz anlegen" >
              <StackPanel Orientation="Horizontal">
                <Grid>
                  <Image Source="/SoftTeach;component/Images/Notentendenz32.png" />
                  <Image Source="/SoftTeach;component/Images/AddOverlay32.png"/>
                </Grid>
                <Label Padding="5,0,0,0" VerticalContentAlignment="Center" Foreground="White">Notentendenz anlegen</Label>
              </StackPanel>
            </Button>
          </StackPanel>
        </Grid>
      </Border>
      <Grid Grid.Row="1" Grid.Column="0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0"  Orientation="Horizontal" Margin="5">
          <Label Style="{StaticResource MetroSubHeader}">Mündlich</Label>
          <Label Style="{StaticResource MetroSubHeader}" Content="{Binding Path=MündlicheGesamtNote}"/>
          <Label Style="{StaticResource MetroSubHeader}" Content="{Binding Path=MündlicheNotenWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
        </StackPanel>
        <ListBox Padding="0" Grid.Column="1" Background="Transparent"
          ItemsSource="{Binding Source={StaticResource MündlicheStandViewSource}}"    
          BorderThickness="0"
          SelectedItem="{Binding CurrentNote}"
          Stylus.IsPressAndHoldEnabled="False"
          Name="MündlicheStandNotenListBox"
          ItemTemplate="{StaticResource MetroStandNotenView}"
          ItemContainerStyle="{StaticResource MetroSilentListBoxItem}">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=MündlicheStandNotenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </Grid>
      <Grid Grid.Row="1" Grid.Column="1">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Column="0"  Margin="5">
          <Label Style="{StaticResource MetroSubHeader}">Schriftlich</Label>
          <Label Style="{StaticResource MetroSubHeader}" Content="{Binding Path=SchriftlicheGesamtNote}"/>
          <Label Style="{StaticResource MetroSubHeader}" Content="{Binding Path=SchriftlicheNotenWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
        </StackPanel>
        <ListBox Grid.Column="1" Margin="3" Padding="0" Background="Transparent"
          ItemsSource="{Binding Source={StaticResource SchriftlicheStandViewSource}}"    
          BorderThickness="0"
          SelectedItem="{Binding CurrentNote}"
          Stylus.IsPressAndHoldEnabled="False"
          Name="SchriftlicheStandNotenListBox"
          ItemTemplate="{StaticResource MetroStandNotenView}"
          ItemContainerStyle="{StaticResource MetroSilentListBoxItem}">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=SchriftlicheStandNotenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </Grid>
      <GroupBox Grid.Row="3" Grid.Column="0" Name="GroupBoxQualität" Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0">Qualität</Label>
            <CheckBox Name="ShowQualitätGraphRadioButton" Style="{StaticResource MetroCheckBoxStyle}" IsChecked="True"  Grid.Column="1" Stylus.IsPressAndHoldEnabled="False" Margin="0">
              <CheckBox.Content>
                <Image Source="/SoftTeach;component/Images/ChartTypeLine32.png" Height="32" />
              </CheckBox.Content>
            </CheckBox>
            <Label Grid.Column="2" Content="{Binding Path=MündlicheQualitätNote}"/>
            <Label Grid.Column="3" Content="{Binding Path=MündlicheQualitätWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
          </Grid>
        </GroupBox.Header>
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
          </Grid.ColumnDefinitions>
          <!--Visibility="{Binding ElementName=ShowQualitätGraphRadioButton, Path=IsChecked, Converter={StaticResource BoolVisibleConverterInverse}}"-->
          <ListBox Grid.Column="0" Margin="0" Padding="0" Background="Transparent"
                 ItemsSource="{Binding Source={StaticResource MündlicheQualitätViewSource}}"             
                 BorderThickness="0"
                 Stylus.IsPressAndHoldEnabled="False"
                 SelectedItem="{Binding CurrentNote}"
                 Name="MündlicheQualitätListBox"
                 ItemTemplate="{StaticResource MetroMündlicheNotenView}"
                 ItemContainerStyle="{StaticResource MetroListBoxItemStyle}"
                 IsManipulationEnabled="True">
            <ListBox.InputBindings>
              <KeyBinding Key="Delete" Command="{Binding Path=DeleteNoteCommand}"/>
            </ListBox.InputBindings>
            <ListBox.ItemsPanel>
              <ItemsPanelTemplate>
                <WrapPanel IsManipulationEnabled="True" Width="{Binding ElementName=MündlicheQualitätListBox, Path=ActualWidth}"/>
              </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
          </ListBox>
          <oxy:Plot Background="Transparent" Grid.Column="1" x:Name="QualitätPlot" PlotAreaBorderThickness="0"  Height="120" Width="400" Visibility="{Binding ElementName=ShowQualitätGraphRadioButton, Path=IsChecked, Converter={StaticResource BoolVisibleConverter}}">
            <oxy:Plot.Axes>
              <oxy:DateTimeAxis MinimumPadding="0.1" MaximumPadding="0.1" FirstDateTime="{Binding MündlicheQualitätFirstDateTime}" LastDateTime="{Binding MündlicheQualitätLastDateTime}" Position="Bottom" IntervalType="Months" StringFormat="MMMM"/>
              <oxy:LinearAxis TickStyle="None" MinimumPadding="0.1" MaximumPadding="0.1" Position="Left" StartPosition="1" EndPosition="0" Minimum=".5" Maximum="6.5" MajorStep="1" MinorStep="1"  MajorGridlineStyle="Solid"/>
            </oxy:Plot.Axes>
            <oxy:Plot.Series>
              <oxy:LineSeries ItemsSource="{Binding Source={StaticResource MündlicheQualitätViewSource}}" DataFieldX="NoteDatum" DataFieldY="NoteZensurGanzeNote" MarkerType="Circle"/>
            </oxy:Plot.Series>
          </oxy:Plot>
        </Grid>
      </GroupBox>
      <GroupBox Grid.Row="4" Grid.Column="0" Name="GroupBoxQuantität"  Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" >Quantität</Label>
            <CheckBox Name="ShowQuantitätGraphRadioButton" Style="{StaticResource MetroCheckBoxStyle}" IsChecked="True"  Grid.Column="1" Stylus.IsPressAndHoldEnabled="False" Margin="0">
              <CheckBox.Content>
                <Image Source="/SoftTeach;component/Images/ChartTypeLine32.png" Height="32" />
              </CheckBox.Content>
            </CheckBox>
            <Label Grid.Column="2" Content="{Binding Path=MündlicheQuantitätNote}"/>
            <Label Grid.Column="3" Content="{Binding Path=MündlicheQuantitätWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
          </Grid>
        </GroupBox.Header>
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
          </Grid.ColumnDefinitions>
          <ListBox Grid.Column="0" Background="Transparent"
          ItemsSource="{Binding Source={StaticResource MündlicheQuantitätViewSource}}" 
          BorderThickness="0"
          Stylus.IsPressAndHoldEnabled="False"
          SelectedItem="{Binding CurrentNote}"
          Name="MündlicheQuantitätListBox"
                 AllowDrop="True"
          ItemTemplate="{StaticResource MetroMündlicheNotenView}"
          ItemContainerStyle="{StaticResource MetroListBoxItemStyle}">
            <ListBox.InputBindings>
              <KeyBinding Key="Delete" Command="{Binding Path=DeleteNoteCommand}"/>
            </ListBox.InputBindings>
            <ListBox.ItemsPanel>
              <ItemsPanelTemplate>
                <WrapPanel Width="{Binding ElementName=MündlicheQuantitätListBox, Path=ActualWidth}"/>
              </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
          </ListBox>
          <oxy:Plot  Background="Transparent" Grid.Column="1" PlotAreaBorderThickness="0" x:Name="QuantitätPlot" Height="120" Width="400" Visibility="{Binding ElementName=ShowQuantitätGraphRadioButton, Path=IsChecked, Converter={StaticResource BoolVisibleConverter}}">
            <oxy:Plot.Axes>
              <oxy:DateTimeAxis MinimumPadding="0.1" MaximumPadding="0.1" FirstDateTime="{Binding MündlicheQuantitätFirstDateTime}" LastDateTime="{Binding MündlicheQuantitätLastDateTime}" Position="Bottom" IntervalType="Auto" StringFormat="MMMM"/>
              <oxy:LinearAxis TickStyle="None" MinimumPadding="0.1" MaximumPadding="0.1" Position="Left" StartPosition="1" EndPosition="0" Minimum=".5" Maximum="6.5" MajorStep="1" MinorStep="1"  MajorGridlineStyle="Solid"/>
            </oxy:Plot.Axes>
            <oxy:Plot.Series>
              <oxy:LineSeries ItemsSource="{Binding Source={StaticResource MündlicheQuantitätViewSource}}" DataFieldX="NoteDatum" DataFieldY="NoteZensurGanzeNote" MarkerType="Circle"/>
            </oxy:Plot.Series>
          </oxy:Plot>
        </Grid>
      </GroupBox>
      <GroupBox Grid.Row="5" Grid.Column="0" Name="GroupBoxWeitereMündlich" Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0" >Weitere</Label>
            <Label Grid.Column="1" VerticalAlignment="Center" Content="{Binding Path=MündlicheWeitereNotenGesamtnote}"/>
            <Label Grid.Column="2" Content="{Binding Path=MündlicheWeitereNotenWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
          </Grid>
        </GroupBox.Header>
        <ListBox  Background="Transparent"
          ItemsSource="{Binding Source={StaticResource MündlicheWeitereViewSource}}"    
          BorderThickness="0"
          SelectedItem="{Binding CurrentNote}"
          Stylus.IsPressAndHoldEnabled="False"
          Name="WeitereMündlicheNotenListBox"
          ItemTemplate="{StaticResource MetroMündlicheNotenView}"
          ItemContainerStyle="{StaticResource MetroListBoxItemStyle}">
          <ListBox.InputBindings>
            <KeyBinding Key="Delete" Command="{Binding Path=DeleteNoteCommand}"/>
          </ListBox.InputBindings>
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=WeitereMündlicheNotenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </GroupBox>
      <GroupBox Name="GroupBoxKlausuren" Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Margin="3,3,3,3" Padding="0">
        <GroupBox.Header>
          <Grid Grid.Row="2" Grid.Column="1" >
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0">Klausuren</Label>
            <Label Grid.Column="1" Content="{Binding Path=SchriftlichKlausurenGesamtnote}"/>
            <Label Grid.Column="2" Content="{Binding Path=SchriftlichKlausurenWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
          </Grid>
        </GroupBox.Header>

        <ListBox  Background="Transparent"
          Name="KlausurenListBox"
          Stylus.IsPressAndHoldEnabled="False"
          ItemsSource="{Binding Path=SchriftlichKlausurenNotenCollection}"
          ItemTemplate="{StaticResource MetroSchriftlicheNotenListView}"
          ItemContainerStyle="{StaticResource MetroSilentListBoxItem}">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <StackPanel/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </GroupBox>
      <GroupBox Name="GroupBoxWeitereSchriftlich" Grid.Row="5" Grid.Column="1"  Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid Grid.Row="2" Grid.Column="1" >
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0">Weitere</Label>
            <Label Grid.Column="1" Content="{Binding Path=SchriftlichWeitereNotenGesamtnote}"/>
            <Label Grid.Column="2" Content="{Binding Path=SchriftlichWeitereNotenWichtung, Converter={StaticResource WichtungProzentConverter}}"/>
          </Grid>
        </GroupBox.Header>

        <ListBox  Background="Transparent"
          Name="WeitereSchriflicheNotenListBox"
          Stylus.IsPressAndHoldEnabled="False"
          ItemsSource="{Binding Path=SchriftlichWeitereNotenCollection}"
          ItemTemplate="{StaticResource MetroMündlicheNotenView}"
          ItemContainerStyle="{StaticResource MetroListBoxItemStyle}">
          <ListBox.InputBindings>
            <KeyBinding Key="Delete" Command="{Binding Path=DeleteNoteCommand}"/>
          </ListBox.InputBindings>
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=WeitereSchriflicheNotenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </GroupBox>
      <GroupBox Name="GroupBoxTendenzen" Grid.Row="6" Grid.Column="0" Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0">Tendenzen</Label>
            <Image Grid.Column="1" Height="32" Source="{Binding Path=TendenzenTendenzImage}"/>
          </Grid>
        </GroupBox.Header>
        <ListBox    Background="Transparent"
                   ItemsSource="{Binding Source={StaticResource GruppierteNotentendenzenViewSource}}"
           Stylus.IsPressAndHoldEnabled="False"
                  BorderThickness="0"
                   SelectedItem="{Binding CurrentNotentendenz}"
                   Name="NotentendenzenListBox"
                   ItemTemplate="{StaticResource MetroNotentendenzenView}"
                   ItemContainerStyle="{StaticResource MetroListBoxItemStyle}">
          <ListBox.InputBindings>
            <KeyBinding Key="Delete" Command="{Binding Path=DeleteNotentendenzCommand}"/>
          </ListBox.InputBindings>
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=NotentendenzenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </GroupBox>
      <GroupBox Name="GroupBoxHausaufgaben" Grid.Row="6" Grid.Column="1"  Margin="3" Padding="0">
        <GroupBox.Header>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0">Hausaufgaben</Label>
            <Image Grid.Column="1" Height="32" Source="{Binding Path=HausaufgabenTendenzImage}"/>
          </Grid>
        </GroupBox.Header>
        <ListBox  Background="Transparent"
                ItemsSource="{Binding Source={StaticResource GruppierteHausaufgabenViewSource}}"
                  BorderThickness="0"
                   SelectedItem="{Binding CurrentHausaufgabe}"
                   Name="HausaufgabenListBox"
                   ItemTemplate="{StaticResource MetroHausaufgabenView}"
                   ItemContainerStyle="{StaticResource MetroListBoxItemStyle}">
          <ListBox.InputBindings>
            <KeyBinding Key="Delete" Command="{Binding Path=DeleteHausaufgabeCommand}"/>
          </ListBox.InputBindings>
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=HausaufgabenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </GroupBox>

      <Grid Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Margin="5">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Column="0" Orientation="Horizontal">
          <Label Style="{StaticResource MetroSubHeader}">Gesamtnote</Label>
          <Label Style="{StaticResource MetroSubHeader}" Content="{Binding Path=Gesamtnote}"/>
        </StackPanel>
        <ListBox Margin="3" Padding="0" Grid.Column="1" Background="Transparent"
          ItemsSource="{Binding Source={StaticResource GesamtstandViewSource}}"    
          BorderThickness="0"
          SelectedItem="{Binding CurrentNote}"
          Stylus.IsPressAndHoldEnabled="False"
          Name="GesamtstandNotenListBox"
          ItemTemplate="{StaticResource MetroStandNotenView}"
          ItemContainerStyle="{StaticResource MetroSilentListBoxItem}">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Width="{Binding ElementName=GesamtstandNotenListBox, Path=ActualWidth}"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
        </ListBox>
      </Grid>
    </Grid>
  </ScrollViewer>
</Page>
